package com.tz.colawallet.ui.presenter;

import com.tz.colawallet.basecode.base.BaseBiz;
import com.tz.colawallet.basecode.base.BaseRespNew;
import com.tz.colawallet.bean.CheckLogin;
import com.tz.colawallet.ui.biz.ABiz;
import com.tz.colawallet.ui.biz.StartBiz;
import com.tz.colawallet.ui.contract.AContract;
import com.tz.colawallet.ui.contract.StartContract;

import javax.inject.Inject;

/**
 * Created by Administrator on 2017/10/25.
 */

public class StartPresenter implements StartContract.StartPresenter {

    StartContract.View view;
    StartBiz biz;

    @Inject
    public StartPresenter(StartContract.View view) {
        this.view = view;
    }


    @Override
    public void setBiz(BaseBiz biz) {
        this.biz = (StartBiz) biz;
    }

    @Override
    public void checkLogin() {
        view.loading(true);
        biz.checkLogin(view.curContext(), new BaseBiz.Callback<BaseRespNew<CheckLogin>>() {
            @Override
            public void onSuccess(BaseRespNew<CheckLogin> o) {
                view.checkLogin(o.getData());
                view.loading(false);
            }

            @Override
            public void onFailure(BaseRespNew o) {
//                view.showMsg(o.getMsg());
                view.checkFalse();
                view.loading(false);
            }
        });
    }


}
